// Copyright DustedPixels.com 2008. All rights reserved.

package com.dustedpixels.dcel.parser;

import java.io.PrintWriter;

import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.util.ASMifierClassVisitor;

import com.dustedpixels.dcel.Unit;

/**
 * @author micapolos@gmail.com (Michal Pociecha-Los)
 */
final class AndInstance extends BaseInstance {
  public AndInstance(Unit unit) {
    super(unit);
  }
  
  public void doRun(int cycles) {
    int[] in1 = pinData.get("IN1");
    int[] in2 = pinData.get("IN2");
    int[] out = pinData.get("OUT");
    int i = 0;
    do {
      out[i] = in1[i] & in2[i];
    } while (++i != cycles);
  }
  
  public static void main(String[] args) throws Exception {
    ClassReader classReader = new ClassReader(AndInstance.class.getName());
    ClassVisitor asmifier = new ASMifierClassVisitor(new PrintWriter(System.out));
    classReader.accept(asmifier, ClassReader.SKIP_DEBUG);
  }
}
